import React from 'react';

import {

} from 'react-native';

import Constants from '../../common/Constants';
import CommonSendFetchAction from '../common/CommonSendFetchAction';

export default class CommonRequestUrlAction extends CommonSendFetchAction {
  constructor() {
    super();
    this.moduleType = Constants.MODULE_TYPE.COMMON;
    this.name = "CommonRequestUrlAction";
  }

  _dealCall(caller, data) {
    caller.setState({
      contentLoading:true,
    })
  }

  _dealFinishSucess(data, response) {
    let detail = "";
    if(data && data.detail != undefined) {
      detail = data.detail;
    }
    this.caller.setState({
      statusText:detail,
      urlData:data,
      contentLoading:false,
    })
  }

  _dealFinishFailed(data, response) {
    let detail = "服务器错误";
    if(data && data.detail != undefined) {
      detail = data.detail;
    }
    this.caller.setState({
      viewStatus:response.status,
      statusText:detail + " " + response.status,
      contentLoading:false,
    })
  }
}
